var webpack = require('webpack');
var path = require('path');
var proxy = require('http-proxy-middleware');

module.exports = {
    entry: './src/App.js',
    output: {
        publicPath: './',
        filename: 'bundle.js',
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                loader: "babel-loader",
                query: {
                    presets: ['es2015', 'react', 'stage-0']
                }
            },
            {
                test:/\.scss$/,
                loader:['style','css','sass']
            },
            {
                test: /\.css$/,
                loaders: ['style-loader', 'css-loader']
            },
            {
                test: /\.(png|jpg|gif|svg)$/,
                loader: 'file-loader',
                options: {
                    name: '[name].[ext]?[hash]'
                }
            }, 
            {
                test: /\.(ttf|eot|svg|woff|woff2)(\?.+)?$/,
                loader: 'file-loader?name=[hash:12].[ext]'
            }
        ]
    },
    devServer: {
        proxy: {
            '/api': {
                target: 'http://10.31.160.25:3000',
                pathRewrite: {
                    '^/api': '/'
                },
                changeOrigin: true
            }
        }
    }
}